package cn.tedu;

import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Scanner;

/**
 * @Classname: Demo06
 * @Author: bromide
 * @CreateTime: 2022/5/9--17:46
 * @Version: V1.0
 * @Description:
 */
public class Demo06 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入英雄名");
        String name = scanner.nextLine();
        System.out.println("请输入价格");
        int money = scanner.nextInt();
        try (Connection conn = DBUtils.getConn())
        {
            Statement s = conn.createStatement();
            //insert into hero(name,money) values('妖姬',6000);
            s.executeUpdate("insert into hero(name,money) values('"+name+"',"+money+")");
            System.out.println("写入完成!");
        } catch (SQLException throwables) {
            throwables.printStackTrace();
        }
    }
}
